home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / self / contrib.lha / contrib / xlib-support / xlib.self < prev    next >
Encoding:
Text File  |  1993-05-18  |  40.6 KB  |  1,510 lines

  1. "Sun-$Revision: 8.2.1 $"
  2.  
  3. "Copyright 1992 Sun Microsystems, Inc. and Stanford University.
  4.  See the LICENSE file for license information."
  5.  
  6.  
  7. "Philosophy of the Xlib interface: the primitives (and their wrappers) conform
  8.  to the standard Xlib calls as close as possible.  These Self objects put a
  9.  very thin layer on that, mainly to make access to the Xlib functions more
  10.  object-oriented and to simplify some Xlib functions by supplying defaults.
  11.  Other objects in the system should be built on top of this layer to provide
  12.  general, non Xlib specific functionality.  The idea is to keep the lowest
  13.  layers close to Xlib so that they can be understood just by reading an Xlib
  14.  reference manual."
  15.  
  16.  
  17. "IMPORTANT: more slots are added to these objects in xlib.wrappers.self"
  18.  
  19.  
  20. "these two slots added for 2.0.1"
  21. traits       _AddSlotsIfAbsent: ( | ^ windowing* = () | )
  22. prototypes _AddSlotsIfAbsent: ( | ^ windowing* = () | )
  23.  
  24. traits     windowing _AddSlotsIfAbsent: ( | ^ xlib = () | )
  25. prototypes windowing _AddSlotsIfAbsent: ( | ^ xlib = () | )
  26.  
  27.  
  28. "--- display ---"
  29.  
  30. "Current design for X display object assumes all work is done on default screen.
  31.  This probably should be changed in the future to allow use of any screen."
  32.  
  33. traits xlib _AddSlotsIfAbsent: ( | ^ display = () | )
  34. traits xlib display _Define: ( |
  35.     _ parent** = traits proxy.
  36.     _ raw* = ().  "Slots are added here (in files generated by primitiveMaker)."
  37.  
  38.     _ whichProxy = 'xlib-display'.
  39.  
  40.     _ connections* = ( |
  41.         ^ open = ( open: '' ).
  42.  
  43.         ^ open: dispName = (
  44.             open: dispName IfFail: [ ^ error:
  45.               'Could not open display \'', (xDisplayName: dispName), '\'' ] ).
  46.  
  47.         ^ open: dispName IfFail: fb = (
  48.             (basicOpen: dispName IfFail: [ | :e | ^ fb value: e ])
  49.          initialize: dispName ).
  50.  
  51.         "kjx changed _XOpenDisplayResultProxy: to
  52.      _XOpenDisplay_wrapxOpenDisplayNameResultProxy: for 2.0.1 VM"
  53.  
  54.         _ basicOpen: dispName IfFail: fb = (
  55.             dispName _XOpenDisplay_wrapxOpenDisplayNameResultProxy:
  56.                 xlib display deadCopy
  57.          IfFail: [ | :e |
  58.            ('badTypeError' isPrefixOf: e)
  59.              ifFalse: [ ^ fb value: e ]
  60.             True: [ dispName asByteVector
  61.                 _XOpenDisplay_wrapOpenDisplayNameResultProxy:
  62.                   xlib display deadCopy IfFail: fb ].
  63.          ] ).
  64.  
  65.         _ initialize: dispName = (
  66.             screen: defaultScreenOfDisplay.
  67.         gc: xlib graphicsContext defaultGCFor: self.
  68.             name: 'X display: ',  dispName.
  69.             file: unixFile copyFd: connectionNumber Name: name.
  70.         self ).
  71.  
  72.         _ defaultGC = ( screen defaultGCOfScreen initOnDisplay: self ).
  73.  
  74.         ^ close = ( basicClose. kill. ).
  75.  
  76.  
  77.         "kjx changed _XCloseDisplayIfFail: to _XCloseDisplay_wrapxCloseIfFail:
  78.      for 2.0.1 VM"
  79.  
  80.         _ basicClose = (
  81.         basicCloseIfFail: [ | :e |
  82.           ^ error: 'X display close failed: ', e ] ).
  83.         _ basicCloseIfFail: fb = (
  84.             _XCloseDisplay_wrapxCloseIfFail: [ | :e |
  85.           ('deadProxyError' isPrefixOf: e)
  86.             ifFalse: [ ^ fb value: e ]
  87.            True: [ (reviveIfFail: [ | :e | fb value: e ])
  88.                _XCloseDisplay_wrapxCloseIfFail: fb ].
  89.             ].
  90.         self ).
  91.     | ).
  92.  
  93.     _ visualMatching* = ( |
  94.     _ visualClasses* = ( |
  95.         staticGray  = 0.
  96.         grayScale   = 1.
  97.         staticColor = 2.
  98.         pseudoColor = 3.
  99.         trueColor   = 4.
  100.         directColor = 5.
  101.     | ).
  102.  
  103.     ^ matchVisualInfoToClass: c Depth: d IfFail: fb = (
  104.             xMatchVisualInfoScreen: screen number
  105.                  Depth: d
  106.                  Class: c
  107.                 IfFail: fb ).
  108.  
  109.         _ isVisualClass: class Depth: depth = ( | vi |
  110.             vi: matchVisualInfoToClass: class
  111.                  Depth: depth
  112.                 IfFail: [ ^ false ].
  113.             vi delete.
  114.         true ).
  115.  
  116.         ^ isPseudoColor8 = ( isVisualClass: pseudoColor Depth: 8 ).
  117.     ^ isGrayScale4     = ( isVisualClass: grayScale    Depth: 4 ).
  118.     ^ isMonochrome     = ( isVisualClass: staticGray    Depth: 1 ).
  119.     | ).
  120.  
  121.     _ synchronization* = ( |
  122.         flush = ( xFlush ).
  123.     synchronize: onoff = ( xSynchronize: onoff ).
  124.     syncDiscardingIf: discard = ( xSyncDiscardingIf: discard ).
  125.     | ).
  126.  
  127.     _ eventHandling* = ( |
  128.     ^ eventsPending = ( xPending ).
  129.  
  130.         ^ nextEvent = ( nonBlockingEventAction: [ blockingNextEvent ] ).
  131.  
  132.         ^ peekEvent = ( nonBlockingEventAction: [ blockingPeekEvent ] ).
  133.  
  134.         _ nonBlockingEventAction: action = (
  135.           [ pending > 0 ifFalse: [ pending: eventsPending ].
  136.             pending > 0 ifTrue:  [ pending: pending pred. ^ action value. ].
  137.             file suspend.
  138.           ] loop ).
  139.  
  140.          "blocking; should never be called except by nextEvent, above"
  141.         _ blockingNextEvent = ( |e|
  142.         e: xlib events xEvent new.
  143.             xNextEventInto: e. 
  144.         e refine).
  145.  
  146.          "blocking; should never be called except by peekEvent, above"
  147.         _ blockingPeekEvent = ( |e|
  148.         e: xlib events xEvent new.
  149.             xPeekEventInto: e.  
  150.         e refine).
  151.     | ).
  152.  
  153.     _ atoms* = ( |
  154.         ^ internAtom: name = ( xInternAtom: name OnlyIfExists: false ).
  155.     | ).
  156.  
  157.     _ fonts* = ( |
  158.         ^ loadFont: name = (
  159.         loadFont: name
  160.           IfFail: [ | :e | error: 'X font load failed: ', e ] ).
  161.  
  162.         ^ loadFont: name IfFail: fb = ( | fs |
  163.         fs: xLoadQueryFont: name IfFail: [ | :e | ^ fb value: e ].
  164.         fs display: self.
  165.         fs ).
  166.     | ).
  167. | )
  168.  
  169. prototypes xlib _AddSlotsIfAbsent: ( | ^ display = () | )
  170. xlib display _Define: proxy deadCopy _AddSlots: ( |
  171.     _ parent* = traits xlib display.
  172.  
  173.     ^ screen  <- nil "xlib screen".
  174.     ^ name    <- 'xlib display prototype'.
  175.     ^ gc      <- nil "xlib graphicsContext".
  176.     _ file    <- unixFile.
  177.     _ pending <- 0.
  178. | )
  179.  
  180.  
  181. "--- drawable ---"
  182.  
  183. traits xlib _AddSlotsIfAbsent: ( | ^ drawable = () | )
  184. traits xlib drawable _Define: ( |
  185.     _ parent** = traits proxy.
  186.     _ raw* = ().
  187.  
  188.     _ polygonShapes* = ( |
  189.         _ complex   = 0.
  190.     _ convex    = 1.
  191.     _ nonconvex = 2.
  192.     | ).
  193.  
  194.     _ coordinateModes* = ( |
  195.         _ coordModeOrigin =   0.
  196.     _ coordModePrevious = 1.
  197.     | ).
  198.  
  199.     _ imageFormats* = ( |
  200.         _ xyBitmap = 0.
  201.         _ xyPixmap = 1.
  202.     _ zPixmap  = 2.
  203.     | ).
  204.  
  205.     _ drawing* = ( |
  206.     ^ copyArea: rect To: dest At: pt GC: gc = (
  207.             display xCopyAreaSrc: self
  208.                 Dest: dest
  209.                   GC: gc
  210.                 SrcX: rect left
  211.                 SrcY: rect top
  212.                Width: rect width
  213.               Height: rect height
  214.                DestX: pt x
  215.                DestY: pt y ).
  216.  
  217.     ^ drawPoint: pt GC: gc = (
  218.         display xDrawPoint: self GC: gc X: pt x Y: pt y ).
  219.  
  220.     ^ drawLine: pt1 To: pt2 GC: gc = (
  221.             display xDrawLine: self GC: gc X1: pt1 x Y1: pt1 y
  222.                        X2: pt2 x Y2: pt2 y ).
  223.  
  224.     ^ drawRectangle: rect GC: gc = (
  225.         display xDrawRectangle: self
  226.                             GC: gc
  227.                  X: rect left
  228.                  Y: rect top
  229.                  Width: rect width
  230.                 Height: rect height ).
  231.  
  232.     ^ fillRectangle: rect GC: gc = (
  233.         display xFillRectangle: self
  234.                             GC: gc
  235.                  X: rect left
  236.                  Y: rect top
  237.                  Width: rect width
  238.                 Height: rect height ).
  239.  
  240.     ^ fillPolygon: ptlist GC: gc = ( | xv. yv. i <- 0. |
  241.         xv: vector copySize: ptlist size.
  242.         yv: vector copySize: ptlist size.
  243.         ptlist do: [ | :p |
  244.         xv at: i Put: p x.
  245.         yv at: i Put: p y.
  246.         i: i + 1. ].
  247.         display xFillPolygon: self
  248.                               GC: gc
  249.                   Xs: xv
  250.                   Ys: yv
  251.                Shape: complex
  252.                 Mode: coordModeOrigin ).
  253.  
  254.         ^ drawArcWithin: rect From: startAngle To: endAngle GC: gc = (
  255.             display xDrawArc: self
  256.               GC: gc
  257.                X: rect left
  258.                Y: rect top
  259.                Width: rect width
  260.               Height: rect height
  261.           StartAngle: startAngle
  262.             EndAngle: endAngle ).
  263.  
  264.         ^ fillArcWithin: rect From: startAngle To: endAngle GC: gc = (
  265.             display xFillArc: self
  266.               GC: gc
  267.                X: rect left
  268.                Y: rect top
  269.                Width: rect width
  270.               Height: rect height
  271.           StartAngle: startAngle
  272.             EndAngle: endAngle ).
  273.  
  274.     ^ drawString: str At: pt GC:gc = (
  275.         display xDrawString: self GC: gc X: pt x Y: pt y String: str ).
  276.     | ).
  277.  
  278.     _ querying* = ( |
  279.         ^ pixelValueAt: pt = ( | im |
  280.             im: display xGetImage: self
  281.                   X: pt x
  282.                   Y: pt y
  283.               Width: 1
  284.              Height: 1
  285.               PlaneMask: 16rffff
  286.              Format: zPixmap.
  287.             im xGetPixelX: 0 Y: 0 ).
  288.  
  289.         ^ bestStippleSizeNear: sz = ( | w. h. |
  290.         w: display xQueryBestStippleWidth: self
  291.                         Width: sz width
  292.                        Height: sz height.
  293.             h: display xQueryBestStippleHeight: self
  294.                      Width: sz width
  295.                     Height: sz height.
  296.             w @ h ).
  297.     | ).
  298.  
  299.     ^ gc = ( display gc ).
  300.  
  301.     "for compatibility with release 2.0.1"
  302.     ^ createBitmapForSameScreenFromData: bv Size: sz = (
  303.         xlib pixmap createBitmapForSameScreenAs: self FromData: bv Size: sz ).
  304. | )
  305.  
  306.  
  307. "--- window ---"
  308.  
  309. traits xlib _AddSlotsIfAbsent: ( | ^ window = () | )
  310. traits xlib window _Define: ( |
  311.     _ parent** = traits xlib drawable.
  312.     _ raw* = ().
  313.  
  314.     _ whichProxy = 'xlib-window'.
  315.  
  316.     _ grabModes* = ( |
  317.         _ grabModeSync  = 0.
  318.         _ grabModeAsync = 1.
  319.     _ currentTime   = 0.
  320.     | ).
  321.  
  322.     _ creating* = ( |
  323.     ^ createOnDisplay: disp At: pos Size: sz = (
  324.         (((disp xCreateSimpleWindowIn: disp screen rootWindow
  325.                     X: pos x
  326.                     Y: pos y
  327.                     Width: sz width
  328.                    Height: sz height
  329.                   BorderWidth: 0
  330.                    Border: disp screen blackPixel
  331.                    Background: disp screen whitePixel
  332.         ) display: disp)
  333.           depth: disp screen depth)
  334.           selfConfigurationRequest ).
  335.  
  336.  
  337.     ^ name: name = ( | tp |
  338.         tp: xlib xTextProperty new.
  339.         tp xStringToTextProperty: name.
  340.         display xSetWMNameOfWindow: self To: tp.
  341.         tp delete.
  342.         self ).
  343.  
  344.     ^ iconName: name = ( | tp |
  345.         tp: xlib xTextProperty new.
  346.         tp xStringToTextProperty: name.
  347.         display xSetWMIconNameOfWindow: self To: tp.
  348.         tp delete.
  349.         self ).
  350.  
  351.     _ selfConfigurationRequest = ( | sizeHints |
  352.         sizeHints: xlib xSizeHints new.
  353.         sizeHints flags: sizeHints pPosition || sizeHints pSize.
  354.         display xSetWMNormalHintsOfWindow: self To: sizeHints.
  355.         sizeHints delete.
  356.         self ).
  357.  
  358.     ^ minSize: minSize = ( | sizeHints |
  359.         sizeHints: xlib xSizeHints new.
  360.         sizeHints flags: sizeHints pMinSize.
  361.         sizeHints min_width:  minSize width.
  362.         sizeHints min_height: minSize height.
  363.         display xSetWMNormalHintsOfWindow: self To: sizeHints.
  364.         sizeHints delete.
  365.         self ).
  366.  
  367.     ^ iconified: iconified Input: input = (
  368.         iconified: iconified Icon: xlib pixmap deadCopy Input: input ).
  369.  
  370.     ^ iconified: iconified Icon: icon Input: input = ( | wmHints |
  371.         wmHints: xlib xWMHints new.
  372.         wmHints initial_state:
  373.           iconified ifTrue: wmHints iconicState False: wmHints normalState.
  374.         wmHints input: input.
  375.         wmHints flags: (wmHints stateHint || wmHints inputHint).
  376.         icon isLive ifTrue: [
  377.         wmHints icon_pixmap: icon.
  378.         wmHints flags: wmHints flags || wmHints iconPixmapHint. ].
  379.         display xSetWMHintsOfWindow: self To: wmHints.
  380.         wmHints delete.
  381.         self ).
  382.  
  383.     ^ catchWMDelete = (
  384.         xlib wmProtocols:    display internAtom: 'WM_PROTOCOLS'.
  385.         xlib wmDeleteWindow: display internAtom: 'WM_DELETE_WINDOW'.
  386.         display xSetWMProtocolOfWindow: self Protocol: xlib wmDeleteWindow.
  387.         self ).
  388.  
  389.     ^ selectInput = (
  390.         display xSelectInputOfWindow: self EventMask: eventMask.  
  391.         self ).
  392.  
  393.     | ).
  394.  
  395.     _ manipulating* = ( |
  396.     ^ map   = ( display xMapWindow:   self ).
  397.     ^ raise = ( display xRaiseWindow: self ).
  398.     ^ clear = ( display xClearWindow: self ).
  399.     | ).
  400.  
  401.     _ cursorOps* = ( |
  402.     ^ warpPointerTo: pt = (
  403.         display xWarpPointerSrcWindow: xlib window nullWindow
  404.                    DestWindow: self
  405.                      SrcX: 0
  406.                      SrcY: 0
  407.                  SrcWidth: 0
  408.                 SrcHeight: 0
  409.                     DestX: pt x
  410.                     DestY: pt y.
  411.         display flush.
  412.         self ).
  413.  
  414.     ^ defineCursor: cursor = (
  415.         display xDefineCursorWindow: self Cursor: cursor ).
  416.     ^ undefineCursor = ( display xUndefineCursorWindow: self ).
  417.  
  418.     ^ grabPointer: cursor = (
  419.         display xGrabPointerWindow: self
  420.                OwnerEvents: true
  421.                  EventMask: eventMask
  422.                PointerMode: grabModeAsync
  423.               KeyboardMode: grabModeAsync
  424.                  ConfineTo: self
  425.                     Cursor: cursor
  426.                       Time: currentTime ).
  427.     ^ grabPointer   = ( grabPointer: xlib cursor nullCursor ).
  428.     ^ ungrabPointer = ( display xUngrabPointerTime: currentTime ).
  429.     | ).
  430. | )
  431.  
  432.  
  433. prototypes xlib _AddSlotsIfAbsent: ( | ^ window = () | )
  434. xlib window _Define: proxy deadCopy _AddSlots: ( |
  435.     _ parent* = traits xlib window.
  436.  
  437.     ^ display   <- xlib display.
  438.     ^ eventMask <- 0.
  439.     ^ depth    <- 1.
  440. | )
  441.  
  442.  
  443. "--- cursor ---"
  444.  
  445. traits xlib _AddSlotsIfAbsent: ( | ^ cursor = () | )
  446. traits xlib cursor _Define: ( |
  447.     _ parent** = traits proxy.
  448.     _ raw* = ().
  449.  
  450.     _ whichProxy = 'xlib-cursor'.
  451.  
  452.     ^ createOnDisplay: disp Shape: shape Mask: mask FG: fg BG: bg
  453.       Hotspot: hotspot = (
  454.         ( disp xCreatePixmapCursorSource: shape
  455.                                     Mask: mask
  456.                          ForegroundColor: fg 
  457.                          BackgroundColor: bg 
  458.                        X: hotspot x
  459.                        Y: hotspot y
  460.         ) display: disp ).
  461.  
  462.     ^ createInvisibleForWindow: win = (
  463.         | bv = (byteVector copySize: 1) at: 0 Put: 0. 
  464.           pix. color. curse. |
  465.         pix: xlib pixmap createBitmapForSameScreenAs: win
  466.                                         FromData: bv
  467.                         Size: 1@@1.
  468.         color: (((xlib xColor new) red: 0) green: 0) blue: 0.
  469.         curse: createOnDisplay: win display
  470.                          Shape: pix
  471.                           Mask: pix
  472.                             FG: color
  473.                             BG: color 
  474.                        Hotspot: 0@0.
  475.         color delete.
  476.         pix delete.
  477.         curse ).
  478.  
  479.     delete = ( display xFreeCursor: self. kill. ).
  480. | )
  481.  
  482. prototypes xlib _AddSlotsIfAbsent: ( | ^ cursor = () | )
  483. xlib cursor _Define: proxy deadCopy _AddSlots: ( |
  484.     _ parent* = traits xlib cursor.
  485.  
  486.     _ display <- xlib display.
  487. | )
  488.  
  489. "--- xGCValues ---"
  490.  
  491. traits xlib _AddSlotsIfAbsent: ( | ^ xGCValues = () | )
  492. traits xlib xGCValues _Define: ( |
  493.     _ parent** = traits proxy.
  494.     _ raw* = ().
  495.  
  496.     _ whichProxy = 'xlib-xGCValues'.
  497. | )
  498.  
  499. prototypes xlib _AddSlotsIfAbsent: ( | ^ xGCValues = () | )
  500. xlib xGCValues _Define: proxy deadCopy _AddSlots: ( |
  501.     _ parent* = traits xlib xGCValues.
  502. | )
  503.  
  504.  
  505. "--- graphicsContext ---"
  506.  
  507. traits xlib _AddSlotsIfAbsent: ( | ^ graphicsContext = () | )
  508. traits xlib graphicsContext _Define: ( |
  509.     _ parent** = traits proxy.
  510.     _ raw* = ().
  511.  
  512.     _ whichProxy = 'xlib-graphicsContext'.
  513.  
  514.     _ attributes* = ( |
  515.         _ gcFunction          = 1 << 0.
  516.     _ gcPlaneMask          = 1 << 1.
  517.     _ gcForeground          = 1 << 2.
  518.     _ gcBackground          = 1 << 3.
  519.     _ gcLineWidth          = 1 << 4.
  520.     _ gcLineStyle          = 1 << 5.
  521.     _ gcCapStyle          = 1 << 6.
  522.     _ gcJoinStyle          = 1 << 7.
  523.     _ gcFillStyle          = 1 << 8.
  524.     _ gcFillRule          = 1 << 9.
  525.     _ gcTile          = 1 << 10.
  526.     _ gcStipple          = 1 << 11.
  527.     _ gcTileStipXOrigin   = 1 << 12.
  528.     _ gcTileStipYOrigin   = 1 << 13.
  529.     _ gcFont          = 1 << 14.
  530.     _ gcSubwindowMode     = 1 << 15.
  531.     _ gcGraphicsExposures = 1 << 16.
  532.     _ gcClipXOrigin          = 1 << 17.
  533.     _ gcClipYOrigin          = 1 << 18.
  534.     _ gcClipMask          = 1 << 19.
  535.     _ gcDashOffset          = 1 << 20.
  536.     _ gcDashList          = 1 << 21.
  537.     _ gcArcMode          = 1 << 22.
  538.     | ).
  539.  
  540.     _ copyFunctions* = ( |
  541.         ^ gxClear        = 16r0.
  542.     ^ gxAnd         = 16r1.
  543.     ^ gxAndReverse     = 16r2.
  544.     ^ gxCopy     = 16r3.
  545.     ^ gxAndInverted     = 16r4.
  546.     ^ gxNoop     = 16r5.
  547.     ^ gxXor         = 16r6.
  548.     ^ gxOr         = 16r7.
  549.     ^ gxNor         = 16r8.
  550.     ^ gxEquiv     = 16r9.
  551.     ^ gxInvert     = 16ra.
  552.     ^ gxXorReverse     = 16rb.
  553.     ^ gxCopyInverted = 16rc.
  554.     ^ gxXorInverted     = 16rd.
  555.     ^ gxNand     = 16re.
  556.     ^ gxSet         = 16rf.
  557.     | ).
  558.  
  559.     _ lineAttributes* = ( |
  560.         _ lineSolid      = 0.
  561.     _ lineOnOffDash  = 1.
  562.     _ lineDoubleDash = 2.
  563.  
  564.     _ capNotLast    = 0.
  565.     _ capButt    = 1.
  566.     _ capRound    = 2.
  567.     _ capProjecting = 3.
  568.  
  569.     _ joinMiter = 0.
  570.     _ joinRound = 1.
  571.     _ joinBevel = 2.
  572.     | ).
  573.  
  574.     _ fillRules* = ( |
  575.         _ evenOddRule = 0.
  576.     _ windingRule = 1.
  577.     | ).
  578.  
  579.     ^ createForSameScreenAs: db = ( | gc |
  580.         gc: db display xCreateGCDrawable: db
  581.                    ValueMask: 0
  582.                       Values: xlib xGCValues new.
  583.         gc initOnDisplay: db display.
  584.         gc ).
  585.  
  586.     ^ defaultGCFor: disp = (
  587.         disp screen defaultGCOfScreen initOnDisplay: disp ).
  588.  
  589.     _ initOnDisplay: disp = (
  590.         display: disp.
  591.     xgcv: xlib xGCValues new.
  592.     self ).
  593.  
  594.     ^ delete = ( xgcv delete. display xFreeGC: self. kill. ).
  595.  
  596.     ^ foreground: fg   = ( display xSetGC: self Foreground: fg ).
  597.     ^ background: bg   = ( display xSetGC: self Background: bg ).
  598.     ^ function: fct    = ( display xSetGC: self Function: fct ).
  599.     ^ plane_mask: mask = ( display xSetGC: self PlaneMask: mask ).
  600.     ^ fillStyle: style = ( display xSetGC: self FillStyle: style ).
  601.     ^ fillRule: rule   = ( display xSetGC: self FillRule: rule ).
  602.     ^ stipple: stip    = ( display xSetGC: self Stipple: stip ).
  603.     ^ font: fid           = ( display xSetGC: self Font: fid ).
  604.     ^ graphics_exposures: bool = (
  605.         display xSetGC: self GraphicsExposures: bool ).
  606.     ^ lineWidth: w Style: l Cap: c Join: j = (
  607.         display xSetGC: self LineAttributesWidth: w
  608.                        LineStyle: l
  609.                         CapStyle: c
  610.                        JoinStyle: j ).
  611.     ^ lineWidth: w = (
  612.         lineWidth: w Style: lineSolid Cap: capButt Join: joinMiter ).
  613.  
  614.     _ fillStyles = ( |
  615.         ^ fillSolid = 0.
  616.     ^ fillTiled = 1.
  617.     ^ fillStippled = 2.
  618.     ^ fillOpaqueStippled = 3.
  619.     | ).
  620.     ^ fillSolid             = ( fillStyle: fillStyles fillSolid ).
  621.     ^ fillTiled             = ( fillStyle: fillStyles fillTiled ).
  622.     ^ fillStippled       = ( fillStyle: fillStyles fillStippled ).
  623.     ^ fillOpaqueStippled = ( fillStyle: fillStyles fillOpaqueStippled ).
  624.  
  625.  
  626.     _ getValues: mask = (
  627.         display xGetGCValuesGC: self ValueMask: mask Values: xgcv ).
  628.  
  629.     ^ foreground = ( getValues: gcForeground. xgcv foreground ).
  630.     ^ background = ( getValues: gcBackground. xgcv background ).
  631.     ^ function   = ( getValues: gcFunction.   xgcv function   ).
  632.     ^ plane_mask = ( getValues: gcPlaneMask.  xgcv plane_mask ).
  633.     ^ fill_style = ( getValues: gcFillStyle.  xgcv fill_style ).
  634.     ^ fill_rule     = ( getValues: gcFillRule.   xgcv fill_rule  ).
  635.     ^ stipple     = ( getValues: gcStipple.    xgcv stipple    ).
  636.     ^ lineWidth  = ( getValues: gcLineWidth.  xgcv line_width ).
  637.     ^ font       = ( getValues: gcFont.          xgcv font          ).
  638.     ^ graphics_exposures = (
  639.         getValues: gcGraphicsExposures. xgcv graphics_exposures ).
  640. | )
  641.  
  642.  
  643. prototypes xlib _AddSlotsIfAbsent: ( | ^ graphicsContext = () | )
  644. xlib graphicsContext _Define: proxy deadCopy _AddSlots: ( |
  645.     _ parent* = traits xlib graphicsContext.
  646.  
  647.     _ display <- xlib display.
  648.     _ xgcv <- xlib xGCValues.
  649. | )
  650.  
  651.  
  652. "--- pixmap ---"
  653.  
  654. traits xlib _AddSlotsIfAbsent: ( | ^ pixmap = () | )
  655. traits xlib pixmap _Define: ( |
  656.     _ parent** = traits xlib drawable.
  657.     _ raw* = ().
  658.     
  659.     _ whichProxy = 'xlib-pixmap'.
  660.  
  661.     ^ createForSameScreenAs: db Size: sz Depth: dp = ( | pm |
  662.           pm: db display xCreatePixmap: db
  663.                            Width: sz width
  664.                   Height: sz height
  665.                    Depth: dp.
  666.     pm display: db display.
  667.     pm size: sz.
  668.     pm depth: dp.
  669.     pm ).
  670.  
  671.     ^ createBitmapForSameScreenAs: db FromData: bv Size: sz = ( | pm |
  672.         pm: db display xCreateBitmapDrawable: db
  673.                         Data: bv
  674.                        Width: sz width
  675.                       Height: sz height.
  676.         pm display: db display.
  677.     pm size: sz.
  678.     pm depth: 1.
  679.     pm ).
  680.  
  681.     ^ delete = ( display xFreePixmap: self. kill. ).
  682. | )
  683.  
  684.  
  685. prototypes xlib _AddSlotsIfAbsent: ( | ^ pixmap = () | )
  686. xlib pixmap _Define: proxy deadCopy _AddSlots: ( |
  687.     _ parent* = traits xlib pixmap.
  688.  
  689.        display <- xlib display.
  690.     ^_ size    <- 0 @@ 0.
  691.     ^_ depth   <- 1.
  692. | )
  693.  
  694.  
  695. "--- visual ---"
  696.  
  697. traits xlib _AddSlotsIfAbsent: ( | ^ visual = () | )
  698. traits xlib visual _Define: ( |
  699.     parent** = traits proxy.
  700.     raw* = ().
  701.     whichProxy = 'xlib-visual'.
  702.  
  703.     "creating a visual by sending defaultVisual to a screen does not
  704.      increase the C-heap"
  705. | )
  706.  
  707. prototypes xlib _AddSlotsIfAbsent: ( | ^ visual = () | )
  708. xlib visual _Define: proxy deadCopy _AddSlots: ( |
  709.     parent* = traits xlib visual.
  710. | )
  711.  
  712.  
  713. "--- xVisualInfo ---"
  714.  
  715. traits xlib _AddSlotsIfAbsent: ( | ^ xVisualInfo = () | )
  716. traits xlib xVisualInfo _Define: ( |
  717.     parent** = traits proxy.
  718.     raw* = ().
  719.     whichProxy = 'xlib-xVisualInfo'.
  720. | )
  721.  
  722. prototypes xlib _AddSlotsIfAbsent: ( | ^ xVisualInfo = () | )
  723. xlib xVisualInfo _Define: proxy deadCopy _AddSlots: ( |
  724.     parent* = traits xlib xVisualInfo.
  725. | )
  726.  
  727.  
  728. "--- colormap ---"
  729.  
  730. traits xlib _AddSlotsIfAbsent: ( | ^ colormap = () | )
  731. traits xlib colormap _Define: ( |
  732.     _ parent** = traits proxy.
  733.     _ raw* = ().
  734.  
  735.     _ whichProxy = 'xlib-colormap'.
  736.  
  737.     ^ createFor: win = (
  738.         ( win display xCreateColormapWindow: win 
  739.                                      Visual: win display screen defaultVisual
  740.                                    Allocate: true
  741.         ) window: win).
  742.  
  743.     ^ delete  = ( window display xFreeColormap: self. kill. ).
  744.  
  745.     ^ install = (
  746.         window display xSetWindow: window Colormap: self.
  747.     self ).
  748.  
  749.     ^ installAndFlush = (
  750.         install.
  751.     window display flush.
  752.     self ).
  753.  
  754.     ^ queryOne: color = (
  755.         window display xQueryColormap: self Color: color.
  756.     self ).
  757.  
  758.     ^ storeOne: color = (
  759.         window display xStoreColormap: self Color: color.
  760.     self ).
  761.  
  762.     ^ query: colors = (
  763.         window display xQueryColormap: self Colors: colors asVector.
  764.         self ).
  765.  
  766.     ^ store: colors = (
  767.         window display xStoreColormap: self Colors: colors asVector.
  768.         self ).
  769. | )
  770.  
  771. prototypes xlib _AddSlotsIfAbsent: ( | ^ colormap = () | )
  772. xlib colormap _Define: proxy deadCopy _AddSlots: ( |
  773.     _ parent* = traits xlib colormap.
  774.  
  775.       window.
  776. | )
  777.  
  778.  
  779. "--- xColor ---"
  780.  
  781. traits xlib _AddSlotsIfAbsent: ( | ^ xColor = () | )
  782. traits xlib xColor _Define: ( |
  783.     _ parent** = traits proxy.
  784.     _ raw* = ().
  785.  
  786.     _ whichProxy = 'xlib-xColor'.
  787.  
  788.     _ flagComponents* = ( |
  789.         _ doRed   = 1 << 0.
  790.         _ doGreen = 1 << 1.
  791.         _ doBlue  = 1 << 2.
  792.     | ).
  793.  
  794.     "ensures that storing & querying will affect all three RGB values"
  795.     ^ allComponents = ( flags: doRed || doGreen || doBlue ).
  796. | )
  797.  
  798. prototypes xlib _AddSlotsIfAbsent: ( | ^ xColor = () | )
  799. xlib xColor _Define: proxy deadCopy _AddSlots: ( |
  800.     _ parent* = traits xlib xColor.
  801. | )
  802.  
  803. traits xlib _AddSlotsIfAbsent: ( | ^ xFontStruct = () | )
  804. traits xlib xFontStruct _Define: ( |
  805.     _ parent** = traits proxy.
  806.     _ raw* = ().
  807.  
  808.     _ whichProxy = 'xlib-xFontStruct'.
  809.  
  810.     ^ delete = ( display xFreeFont: self. kill. ).
  811.  
  812.     ^ textWidth: str = ( xTextWidth: str ).
  813. | )
  814.  
  815. prototypes xlib _AddSlotsIfAbsent: ( | ^ xFontStruct = () | )
  816. xlib xFontStruct _Define: proxy deadCopy _AddSlots: ( |
  817.     _ parent* = traits xlib xFontStruct.
  818.  
  819.       display <- xlib display.
  820. | )
  821.  
  822. traits xlib _AddSlotsIfAbsent: ( | ^ xCharStruct = () | )
  823. traits xlib xCharStruct _Define: ( |
  824.     _ parent** = traits proxy.
  825.     _ raw* = ().
  826.  
  827.     _ whichProxy = 'xlib-xFontStruct'.
  828. | )
  829.  
  830. prototypes xlib _AddSlotsIfAbsent: ( | ^ xCharStruct = () | )
  831. xlib xCharStruct _Define: ( |
  832.     _ parent* = traits xlib xCharStruct.
  833. | )
  834.  
  835. traits xlib _AddSlotsIfAbsent: ( | ^ font = () | )
  836. traits xlib font _Define: ( |
  837.     _ parent** = traits proxy.
  838.  
  839.     _ whichProxy = 'xlib-font'.
  840.  
  841.     ^ delete = ( kill ).
  842. | )
  843.  
  844. prototypes xlib _AddSlotsIfAbsent: ( | ^ font = () | )
  845. xlib font _Define: proxy deadCopy _AddSlots: ( |
  846.     _ parent* = traits xlib font.
  847. | ) 
  848.  
  849.  
  850. "--- screen ---"
  851.  
  852. traits xlib _AddSlotsIfAbsent: ( | ^ screen = () | )
  853. traits xlib screen _Define: ( |
  854.     _ parent** = traits proxy.
  855.     _ raw* = ().
  856.  
  857.     _ whichProxy = 'xlib-screen'.
  858.  
  859.     ^ rootWindow    = ( rootWindowOfScreen ).
  860.     ^ defaultVisual = ( defaultVisualOfScreen ).
  861.  
  862.     ^ blackPixel = ( blackPixelOfScreen ).
  863.     ^ whitePixel = ( whitePixelOfScreen ).
  864.     ^ width     = ( widthOfScreen ).
  865.     ^ height     = ( heightOfScreen ).
  866.     ^ size     = ( width @@ height ).
  867.     ^ depth     = ( defaultDepthOfScreen ).
  868.  
  869.     ^ number     = ( xScreenNumberOfScreen ).
  870. | )
  871.  
  872. prototypes xlib _AddSlotsIfAbsent: ( | ^ screen = () | )
  873. xlib screen _Define: proxy deadCopy _AddSlots: ( |
  874.     _ parent* = traits xlib screen.
  875. | )
  876.  
  877.  
  878. "--- image ---"
  879.  
  880. traits xlib _AddSlotsIfAbsent: ( | ^ xImage = () | )
  881. traits xlib xImage _Define: ( |
  882.     _ parent** = traits proxy.
  883.     _ raw* = ().
  884.  
  885.     _ whichProxy = 'xlib-xImage'.
  886. | )
  887.  
  888. prototypes xlib _AddSlotsIfAbsent: ( | ^ xImage = () | )
  889. xlib xImage _Define: proxy deadCopy _AddSlots: ( | 
  890.     _ parent* = traits xlib xImage.
  891. | )
  892.  
  893.  
  894. "--- events ---"
  895.  
  896. traits xlib _AddSlotsIfAbsent: ( | ^ events = () | )
  897. traits xlib events _Define: ( |
  898.     _ parent** = traits proxy.
  899.     _ raw* = ().
  900.  
  901.     _ whichProxy = 'xlib-events'.
  902.  
  903.     _ masks* = ( |
  904.     ^ noEventMask              = 0.
  905.     ^ keyPressMask             = 1 << 0.
  906.     ^ keyReleaseMask           = 1 << 1.
  907.     ^ buttonPressMask          = 1 << 2.
  908.     ^ buttonReleaseMask        = 1 << 3.
  909.     ^ enterWindowMask          = 1 << 4.
  910.     ^ leaveWindowMask          = 1 << 5.
  911.     ^ pointerMotionMask        = 1 << 6.
  912.     ^ pointerMotionHintMask    = 1 << 7.
  913.     ^ button1MotionMask        = 1 << 8.
  914.     ^ button2MotionMask        = 1 << 9.
  915.     ^ button3MotionMask        = 1 << 10.
  916.     ^ button4MotionMask        = 1 << 11.
  917.     ^ button5MotionMask        = 1 << 12.
  918.     ^ buttonMotionMask         = 1 << 13.
  919.     ^ keymapStateMask          = 1 << 14.
  920.     ^ exposureMask             = 1 << 15.
  921.     ^ visibilityChangeMask     = 1 << 16.
  922.     ^ structureNotifyMask      = 1 << 17.
  923.     ^ resizeRedirectMask       = 1 << 18.
  924.     ^ substructureNotifyMask   = 1 << 19.
  925.     ^ substructureRedirectMask = 1 << 20.
  926.     ^ focusChangeMask          = 1 << 21.
  927.     ^ propertyChangeMask       = 1 << 22.
  928.     ^ colormapChangeMask       = 1 << 23.
  929.     ^ ownerGrabButtonMask      = 1 << 24.
  930.     | ).
  931.  
  932.     _ queueModes* = ( |
  933.     ^ queuedAlready      = 0.
  934.     ^ queuedAfterReading = 1.
  935.     ^ queuedAfterFlush   = 2.
  936.     | ).
  937. | )
  938.  
  939. prototypes xlib _AddSlotsIfAbsent: ( | ^ events = () | )
  940. xlib events _Define: proxy deadCopy _AddSlots: ( |
  941.     _ parent** = traits xlib events.
  942.     _ raw* = ().
  943. | )
  944.  
  945.  
  946. traits xlib events _AddSlotsIfAbsent: ( | ^ xEvent = () | )
  947. traits xlib events xEvent _Define: ( |
  948.     _ parent** = traits proxy.
  949.     _ raw* = ().
  950.  
  951.     _ whichProxy = ( 'xlib-xEvent-', typeName ).
  952.     ^ typeName = 'generic'.
  953.  
  954.     "compatibility with 2.0.1"
  955.     ^ hasButtonInfo = false.
  956.  
  957.     ^ hasInputStateInfo = false.
  958.     ^ hasLocationInfo = false.
  959.  
  960.     _ types* = ( |
  961.     ^ keyPress         = 2.
  962.     ^ keyRelease       = 3.
  963.     ^ buttonPress      = 4.
  964.     ^ buttonRelease    = 5.
  965.     ^ motionNotify     = 6.
  966.     ^ enterNotify      = 7.
  967.     ^ leaveNotify      = 8.
  968.     ^ focusIn          = 9.
  969.     ^ focusOut         = 10.
  970.     ^ keymapNotify     = 11.
  971.     ^ expose           = 12.
  972.     ^ graphicsExpose   = 13.
  973.     ^ noExpose         = 14.
  974.     ^ visibilityNotify = 15.
  975.     ^ createNotify     = 16.
  976.     ^ destroyNotify    = 17.
  977.     ^ unmapNotify      = 18.
  978.     ^ mapNotify        = 19.
  979.     ^ mapRequest       = 20.
  980.     ^ reparentNotify   = 21.
  981.     ^ configureNotify  = 22.
  982.     ^ configureRequest = 23.
  983.     ^ gravityNotify    = 24.
  984.     ^ resizeRequest    = 25.
  985.     ^ circulateNotify  = 26.
  986.     ^ circulateRequest = 27.
  987.     ^ propertyNotify   = 28.
  988.     ^ selectionClear   = 29.
  989.     ^ selectionRequest = 30.
  990.     ^ selectionNotify  = 31.
  991.     ^ colormapNotify   = 32.
  992.     ^ clientMessage    = 33.
  993.     ^ mappingNotify    = 34.
  994.     | ).
  995.  
  996.  
  997.  
  998.     ^ refine = ( | t. et. |
  999.         t: type.
  1000.     et: traits xlib events.
  1001.  
  1002.     motionNotify  = t ifTrue: [ ^ xmotion ].
  1003.         buttonPress   = t ifTrue: [ ^ xbutton parent: et xButtonPressedEvent  ].
  1004.         buttonRelease = t ifTrue: [ ^ xbutton parent: et xButtonReleasedEvent ].
  1005.         keyPress      = t ifTrue: [ ^ xkey      parent: et xKeyPressedEvent   ].
  1006.         keyRelease    = t ifTrue: [ ^ xkey      parent: et xKeyReleasedEvent  ].
  1007.         enterNotify   = t ifTrue: [ ^ xcrossing parent: et xEnterWindowEvent  ].
  1008.         leaveNotify   = t ifTrue: [ ^ xcrossing parent: et xLeaveWindowEvent  ].
  1009.         colormapNotify   = t ifTrue: [ ^ xcolormap       ].
  1010.         expose           = t ifTrue: [ ^ xexpose     ].
  1011.         configureNotify  = t ifTrue: [ ^ xconfigure     ].
  1012.         visibilityNotify = t ifTrue: [ ^ xvisibility     ].
  1013.         mapNotify     = t ifTrue: [ ^ xmap             ].
  1014.     unmapNotify     = t ifTrue: [ ^ xunmap         ].
  1015.         reparentNotify     = t ifTrue: [ ^ xreparent     ].
  1016.         clientMessage     = t ifTrue: [ ^ xclient     ].
  1017.     graphicsExpose     = t ifTrue: [ ^ xgraphicsexpose ].
  1018.     noExpose     = t ifTrue: [ ^ xnoexpose     ].
  1019.  
  1020.     xany ).
  1021.  
  1022.     ^ delete = ( asXEvent basicDelete. kill ).
  1023.  
  1024.     ^ putBackOnDisplay: d = ( | e |
  1025.         e: asXEvent.
  1026.     d xPutBackEvent: e.
  1027.     e delete.
  1028.     self ).
  1029. | )
  1030.  
  1031. prototypes xlib events _AddSlotsIfAbsent: ( | ^ xEvent = () | )
  1032. xlib events xEvent _Define: proxy  deadCopy _AddSlots: ( |
  1033.     _ parent** = traits xlib events xEvent.
  1034.     _ raw* = ().
  1035. | )
  1036.  
  1037.  
  1038. traits xlib events _AddSlotsIfAbsent: ( | ^ xInputEvent = () | )
  1039. traits xlib events xInputEvent _Define: ( |
  1040.     _ parent** = traits xlib events xEvent.
  1041.     _ raw* = ().
  1042.  
  1043.     _ states* = ( |
  1044.         ^ shiftMask   = 1 << 0.
  1045.         ^ lockMask    = 1 << 1.
  1046.         ^ controlMask = 1 << 2.
  1047.         ^ mod1Mask    = 1 << 3.
  1048.         ^ mod2Mask    = 1 << 4.
  1049.         ^ mod3Mask    = 1 << 5.
  1050.         ^ mod4Mask    = 1 << 6.
  1051.         ^ mod5Mask    = 1 << 7.
  1052.         ^ button1Mask = 1 << 8.
  1053.         ^ button2Mask = 1 << 9.
  1054.         ^ button3Mask = 1 << 10.
  1055.         ^ button4Mask = 1 << 11.
  1056.         ^ button5Mask = 1 << 12.
  1057.  
  1058.         ^ anyButtonMask = 16r1f00.
  1059.     | ).
  1060. | )
  1061.  
  1062.  
  1063.  
  1064. traits xlib events _AddSlotsIfAbsent: ( | ^ xButtonEvent = () | )
  1065. traits xlib events xButtonEvent _Define: ( |
  1066.     _ parent** = traits xlib events xInputEvent.
  1067.     _ raw* = ().
  1068.  
  1069.  
  1070.     "compatibility with 2.0.1"
  1071.     ^ hasButtonInfo = true.
  1072.  
  1073.     ^ hasInputStateInfo = true.
  1074.     ^ hasLocationInfo = true.
  1075.  
  1076.     _ details* = ( |
  1077.         button1 = 1.
  1078.         button2 = 2.
  1079.         button3 = 3.
  1080.         button4 = 4.
  1081.         button5 = 5.
  1082.     | ).
  1083.  
  1084.     ^ buttonName = ( buttonName: button ).
  1085.       buttonName: b = (
  1086.         b = button1 ifTrue: [ ^ 'left' ].
  1087.         b = button2 ifTrue: [ ^ 'middle' ].
  1088.         b = button3 ifTrue: [ ^ 'right' ].
  1089.         error: 'unknown button'. ).
  1090.  
  1091.     "compatibility with 2.0.1"
  1092.     postState = ( newState ).
  1093.     postStateFrom: s Changing: b = ( newStateFrom: s Changing: b ).
  1094.  
  1095.     ^ newState = ( newStateFrom: state Changing: button ).
  1096.     _ newStateFrom: s Changing: b = (
  1097.         b = button1 ifTrue: [ ^ s ^^ button1Mask ].
  1098.         b = button2 ifTrue: [ ^ s ^^ button2Mask ].
  1099.         b = button3 ifTrue: [ ^ s ^^ button3Mask ].
  1100.         error: 'unknown button'. ).
  1101. | )
  1102.  
  1103.  
  1104. traits xlib events _AddSlotsIfAbsent: ( | ^ xButtonPressedEvent = () | )
  1105. traits xlib events xButtonPressedEvent _Define: ( |
  1106.     _ parent** = traits xlib events xButtonEvent.
  1107.     _ raw* = ().
  1108.  
  1109.     ^ typeName = 'buttonPress'.
  1110. | )
  1111.  
  1112. traits xlib events _AddSlotsIfAbsent: ( | ^ xButtonReleasedEvent = () | )
  1113. traits xlib events xButtonReleasedEvent _Define: ( |
  1114.     _ parent** = traits xlib events xButtonEvent.
  1115.     _ raw* = ().
  1116.  
  1117.     ^ typeName = 'buttonRelease'.
  1118. | )
  1119.  
  1120. prototypes xlib events _AddSlotsIfAbsent: ( | ^ xButtonEvent = () | )
  1121. xlib events xButtonEvent _Define: proxy deadCopy _AddSlots: ( |
  1122.     _ parent** <- traits xlib events xButtonEvent.
  1123. | )
  1124.  
  1125.  
  1126.  
  1127. traits xlib events _AddSlotsIfAbsent: ( | ^ xKeyEvent = () | )
  1128. traits xlib events xKeyEvent _Define: ( |
  1129.     _ parent** = traits xlib events xInputEvent.
  1130.     _ raw* = ().
  1131.  
  1132.     "compatibility with 2.0.1"
  1133.     ^ hasButtonInfo = true.
  1134.  
  1135.     ^ hasInputStateInfo = true.
  1136.  
  1137.     "this is specific to Sun Type 4 keyboards"     
  1138.     _ kbdModifierMasks = (((((((((dictionary copyRemoveAll
  1139.                     at: 106 Put: shiftMask)   "shift_left"
  1140.                     at: 117 Put: shiftMask)   "shift_right"
  1141.                     at: 126 Put: lockMask)    "caps_lock"
  1142.                     at: 83  Put: controlMask) "control"
  1143.                     at: 127 Put: mod1Mask)    "meta_left"
  1144.                     at: 129 Put: mod1Mask)    "meta_right"
  1145.                     at: 20  Put: mod2Mask)    "alt_graph"
  1146.                     at: 105 Put: mod3Mask)    "num_lock"
  1147.                     at: 26  Put: mod4Mask ).  "alt"
  1148.  
  1149.     ^ newState = ( newStateFrom: state Changing: keycode ).
  1150.     _ newStateFrom: s Changing: kc = (
  1151.         s ^^ (kbdModifierMasks at: kc IfAbsent: 0) ).
  1152.  
  1153.     ^ lookupString = ( | bv = '' copySize: 5. n. |
  1154.         n: xLookupStringReturn: bv.
  1155.     bv copySize: n ).
  1156. | )
  1157.  
  1158.  
  1159. traits xlib events _AddSlotsIfAbsent: ( | ^ xKeyPressedEvent = () | )
  1160. traits xlib events xKeyPressedEvent _Define: ( |
  1161.     _ parent** = traits xlib events xKeyEvent.
  1162.     _ raw* = ().
  1163.  
  1164.     ^ typeName = 'keyPress'.
  1165. | )
  1166.  
  1167. traits xlib events _AddSlotsIfAbsent: ( | ^ xKeyReleasedEvent = () | )
  1168. traits xlib events xKeyReleasedEvent _Define: ( |
  1169.     _ parent** = traits xlib events xKeyEvent.
  1170.     _ raw* = ().
  1171.  
  1172.     ^ typeName = 'keyRelease'.
  1173. | )
  1174.  
  1175. prototypes xlib events _AddSlotsIfAbsent: ( | ^ xKeyEvent = () | )
  1176. xlib events xKeyEvent _Define: proxy deadCopy _AddSlots: ( |
  1177.     _ parent* <- traits xlib events xKeyEvent.
  1178. | )
  1179.  
  1180.  
  1181.  
  1182. traits xlib events _AddSlotsIfAbsent: ( | ^ xExposeEvent = () | )
  1183. traits xlib events xExposeEvent _Define: ( |
  1184.     _ parent** = traits xlib events xEvent.
  1185.     _ raw* = ().
  1186.  
  1187.     ^ typeName = 'expose'.
  1188. | )
  1189.  
  1190. prototypes xlib events _AddSlotsIfAbsent: ( | ^ xExposeEvent = () | )
  1191. xlib events xExposeEvent _Define: proxy deadCopy _AddSlots: ( |
  1192.     _ parent* = traits xlib events xExposeEvent.
  1193. | )
  1194.  
  1195.  
  1196. traits xlib events _AddSlotsIfAbsent: ( | ^ xNoExposeEvent = () | )
  1197. traits xlib events xNoExposeEvent _Define: ( |
  1198.     _ parent** = traits xlib events xEvent.
  1199.     _ raw* = ().
  1200.  
  1201.     ^ typeName = 'noexpose'.
  1202. | )
  1203.  
  1204. prototypes xlib events _AddSlotsIfAbsent: ( | ^ xNoExposeEvent = () | )
  1205. xlib events xNoExposeEvent _Define: proxy deadCopy _AddSlots: ( |
  1206.     _ parent* = traits xlib events xNoExposeEvent.
  1207. | )
  1208.  
  1209. traits xlib events _AddSlotsIfAbsent: ( | ^ xGraphicsExposeEvent = () | )
  1210. traits xlib events xGraphicsExposeEvent _Define: ( |
  1211.     _ parent** = traits xlib events xEvent.
  1212.     _ raw* = ().
  1213.  
  1214.     ^ typeName = 'graphicsexpose'.
  1215. | )
  1216.  
  1217. prototypes xlib events _AddSlotsIfAbsent: ( | ^ xGraphicsExposeEvent = () | )
  1218. xlib events xGraphicsExposeEvent _Define: proxy deadCopy _AddSlots: ( |
  1219.     _ parent* = traits xlib events xGraphicsExposeEvent.
  1220. | )
  1221.  
  1222.  
  1223. traits xlib events _AddSlotsIfAbsent: ( | ^ xExposeEvent = () | )
  1224. traits xlib events xExposeEvent _Define: ( |
  1225.     _ parent** = traits xlib events xEvent.
  1226.     _ raw* = ().
  1227.  
  1228.     ^ typeName = 'expose'.
  1229. | )
  1230.  
  1231. prototypes xlib events _AddSlotsIfAbsent: ( | ^ xExposeEvent = () | )
  1232. xlib events xExposeEvent _Define: proxy deadCopy _AddSlots: ( |
  1233.     _ parent* = traits xlib events xExposeEvent.
  1234. | )
  1235.  
  1236.  
  1237. traits xlib events _AddSlotsIfAbsent: ( | ^ xMotionEvent = () | )
  1238. traits xlib events xMotionEvent _Define: ( |
  1239.     _ parent** = traits xlib events xInputEvent.
  1240.     _ raw* = ().
  1241.  
  1242.     ^ typeName = 'motionNotify'.
  1243.     ^ hasLocationInfo = true.
  1244.     ^ newState = ( state ).
  1245. | )
  1246.  
  1247. prototypes xlib events _AddSlotsIfAbsent: ( | ^ xMotionEvent = () | )
  1248. xlib events xMotionEvent _Define: proxy deadCopy _AddSlots: ( |
  1249.     _ parent* = traits xlib events xMotionEvent.
  1250. | )
  1251.  
  1252.  
  1253. traits xlib events _AddSlotsIfAbsent: ( | ^ xConfigureEvent = () | )
  1254. traits xlib events xConfigureEvent _Define: ( |
  1255.     _ parent** = traits xlib events xEvent.
  1256.     _ raw* = ().
  1257.  
  1258.     ^ typeName = 'configureNotify'.
  1259. | )
  1260.  
  1261. prototypes xlib events _AddSlotsIfAbsent: ( | ^ xConfigureEvent = () | )
  1262. xlib events xConfigureEvent _Define: proxy deadCopy _AddSlots: ( |
  1263.     _ parent* = traits xlib events xConfigureEvent.
  1264. | )
  1265.  
  1266.  
  1267. traits xlib events _AddSlotsIfAbsent: ( | ^ xClientMessageEvent = () | )
  1268. traits xlib events xClientMessageEvent _Define: ( |
  1269.     _ parent** = traits xlib events xEvent.
  1270.     _ raw* = ().
  1271.  
  1272.     ^ typeName = 'clientMessage'.
  1273.  
  1274.     ^ isDeleteWindow = ( (message_type = xlib wmProtocols) &&
  1275.              [(atomAt: 0) = xlib wmDeleteWindow] ).
  1276. | )
  1277.  
  1278. prototypes xlib events _AddSlotsIfAbsent: ( | ^ xClientMessageEvent = () | )
  1279. xlib events xClientMessageEvent _Define: proxy deadCopy _AddSlots: ( |
  1280.     _ parent* = traits xlib events xClientMessageEvent.
  1281. | )
  1282.  
  1283.  
  1284. traits xlib events _AddSlotsIfAbsent: ( | ^ xVisibilityEvent = () | )
  1285. traits xlib events xVisibilityEvent _Define: ( |
  1286.     _ parent** = traits xlib events xEvent.
  1287.     _ raw* = ().
  1288.  
  1289.     ^ typeName = 'visibilityNotify'.
  1290.  
  1291.     _ states* = ( |
  1292.         visibilityUnobscured        = 0.
  1293.         visibilityPartiallyObscured = 1.
  1294.         visibilityFullyObscured     = 2.
  1295.     | ).
  1296. | )
  1297.  
  1298. prototypes xlib events _AddSlotsIfAbsent: ( | ^ xVisibilityEvent = () | )
  1299. xlib events xVisibilityEvent _Define: proxy deadCopy _AddSlots: ( |
  1300.     _ parent* = traits xlib events xVisibilityEvent.
  1301. | )
  1302.  
  1303.  
  1304. traits xlib events _AddSlotsIfAbsent: ( | ^ xCrossingEvent = () | )
  1305. traits xlib events xCrossingEvent _Define: ( |
  1306.     _ parent** = traits xlib events xEvent.
  1307.     _ raw* = ().
  1308. | )
  1309.  
  1310. traits xlib events _AddSlotsIfAbsent: ( | ^ xEnterWindowEvent = () | )
  1311. traits xlib events xEnterWindowEvent _Define: ( |
  1312.     _ parent** = traits xlib events xCrossingEvent.
  1313.     _ raw* = ().
  1314.  
  1315.     ^ typeName = 'enterNotify'.
  1316. | )
  1317.  
  1318. traits xlib events _AddSlotsIfAbsent: ( | ^ xLeaveWindowEvent = () | )
  1319. traits xlib events xLeaveWindowEvent _Define: ( |
  1320.     _ parent** = traits xlib events xCrossingEvent.
  1321.     _ raw* = ().
  1322.  
  1323.     ^ typeName = 'leaveNotify'.
  1324. | )
  1325.  
  1326. prototypes xlib events _AddSlotsIfAbsent: ( | ^ xCrossingEvent = () | )
  1327. xlib events xCrossingEvent _Define: proxy deadCopy _AddSlots: ( |
  1328.     _ parent* <- traits xlib events xCrossingEvent.
  1329. | )
  1330.  
  1331.  
  1332. traits xlib events _AddSlotsIfAbsent: ( | ^ xMapEvent = () | )
  1333. traits xlib events xMapEvent _Define: ( |
  1334.     _ parent** = traits xlib events xEvent.
  1335.     _ raw* = ().
  1336.  
  1337.     ^ typeName = 'mapNotify'.
  1338. | )
  1339.  
  1340. prototypes xlib events _AddSlotsIfAbsent: ( | ^ xMapEvent = () | )
  1341. xlib events xMapEvent _Define: proxy deadCopy _AddSlots: ( |
  1342.     _ parent* = traits xlib events xMapEvent.
  1343. | )
  1344.  
  1345. traits xlib events _AddSlotsIfAbsent: ( | ^ xUnmapEvent = () | )
  1346. traits xlib events xUnmapEvent _Define: ( |
  1347.     _ parent** = traits xlib events xEvent.
  1348.     _ raw* = ().
  1349.  
  1350.     ^ typeName = 'unmapNotify'.
  1351. | )
  1352.  
  1353. prototypes xlib events _AddSlotsIfAbsent: ( | ^ xUnmapEvent = () | )
  1354. xlib events xUnmapEvent _Define: proxy deadCopy _AddSlots: ( |
  1355.     _ parent* = traits xlib events xUnmapEvent.
  1356. | )
  1357.  
  1358.  
  1359. traits xlib events _AddSlotsIfAbsent: ( | ^ xColormapEvent = () | )
  1360. traits xlib events xColormapEvent _Define: ( |
  1361.     _ parent** = traits xlib events xEvent.
  1362.     _ raw* = ().
  1363.  
  1364.     ^ typeName = 'colormapNotify'.
  1365.  
  1366.     _ states* = ( |
  1367.         _ colormapUninstalled = 0.
  1368.         _ colormapInstalled   = 1.
  1369.     | ).
  1370. | )
  1371.  
  1372. prototypes xlib events _AddSlotsIfAbsent: ( | ^ xColormapEvent = () | )
  1373. xlib events xColormapEvent _Define: proxy deadCopy _AddSlots: ( |
  1374.     _ parent* = traits xlib events xColormapEvent.
  1375. | )
  1376.  
  1377.  
  1378. traits xlib events _AddSlotsIfAbsent: ( | ^ xReparentEvent = () | )
  1379. traits xlib events xReparentEvent _Define: ( |
  1380.     _ parent** = traits xlib events xEvent.
  1381.     _ raw* = ().
  1382.  
  1383.     ^ typeName = 'reparentNotify'.
  1384. | )
  1385.  
  1386. prototypes xlib events _AddSlotsIfAbsent: ( | ^ xReparentEvent = () | )
  1387. xlib events xReparentEvent _Define: proxy deadCopy _AddSlots: ( |
  1388.     _ parent* = traits xlib events xReparentEvent.
  1389. | )
  1390.  
  1391.  
  1392. traits xlib events _AddSlotsIfAbsent: ( | ^ xAnyEvent = () | )
  1393. traits xlib events xAnyEvent _Define: ( |
  1394.     _ parent** = traits xlib events xEvent.
  1395.     _ raw* = ().
  1396.  
  1397.     ^ typeName = 'otherEvent'.
  1398. | )
  1399.  
  1400. prototypes xlib events _AddSlotsIfAbsent: ( | ^ xAnyEvent = () | )
  1401. xlib events xAnyEvent _Define: proxy deadCopy _AddSlots: ( |
  1402.     _ parent* = traits xlib events xAnyEvent.
  1403. | )
  1404.  
  1405.  
  1406.  
  1407. "--- hint structures ---"
  1408.  
  1409. traits xlib _AddSlotsIfAbsent: ( | ^ xSizeHints = () | )
  1410. traits xlib xSizeHints _Define: ( |
  1411.     _ parent** = traits proxy.
  1412.     _ raw* = ().
  1413.  
  1414.     _ whichProxy = 'xlib-xSizeHints'.
  1415.  
  1416.     _ flagBits* = ( |
  1417.         usPosition  = 1 << 0.
  1418.         usSize      = 1 << 1.
  1419.         pPosition   = 1 << 2.
  1420.         pSize       = 1 << 3.
  1421.         pMinSize    = 1 << 4.
  1422.         pMaxSize    = 1 << 5.
  1423.         pResizeInc  = 1 << 6.
  1424.         pAspect     = 1 << 7.
  1425.         pBaseSize   = 1 << 8.
  1426.         pWinGravity = 1 << 9.
  1427.     | ).
  1428. | )
  1429.  
  1430. prototypes xlib _AddSlotsIfAbsent: ( | ^ xSizeHints = () | )
  1431. xlib xSizeHints _Define: proxy deadCopy _AddSlots: ( |
  1432.     _ parent* = traits xlib xSizeHints.
  1433. | )
  1434.  
  1435.  
  1436. traits xlib _AddSlotsIfAbsent: ( | ^ xWMHints = () | )
  1437. traits xlib xWMHints _Define: ( |
  1438.     _ parent** = traits proxy.
  1439.     _ raw* = ().
  1440.  
  1441.     _ whichProxy = 'xlib-xWMHints'.
  1442.  
  1443.     _ flagBits* = ( |
  1444.         inputHint        = 1 << 0.
  1445.         stateHint        = 1 << 1.
  1446.         iconPixmapHint   = 1 << 2.
  1447.         iconWindowHint   = 1 << 3.
  1448.         iconPositionHint = 1 << 4.
  1449.         iconMaskHint     = 1 << 5.
  1450.         windowGroupHint  = 1 << 6.
  1451.     | ).
  1452.  
  1453.     _ initialStates* = ( |
  1454.         withdrawnState = 0.
  1455.         normalState    = 1.
  1456.         iconicState    = 3.
  1457.     | ).
  1458. | )
  1459.  
  1460. prototypes xlib _AddSlotsIfAbsent: ( | ^ xWMHints = () | )
  1461. xlib xWMHints _Define: proxy deadCopy _AddSlots: ( |
  1462.     _ parent* = traits xlib xWMHints.
  1463. | )
  1464.  
  1465.  
  1466. traits xlib _AddSlotsIfAbsent: ( | ^ xTextProperty = () | )
  1467. traits xlib xTextProperty _Define: ( |
  1468.     _ parent** = traits proxy.
  1469.     _ raw* = ().
  1470.  
  1471.     _ whichProxy = 'xlib-xTextProperty'.
  1472.  
  1473.     ^ delete = ( | v |
  1474.         v: value.
  1475.     freeValue: v.
  1476.     v kill.
  1477.     basicDelete. ).
  1478. | )
  1479.  
  1480. prototypes xlib _AddSlotsIfAbsent: ( | ^ xTextProperty = () | )
  1481. xlib xTextProperty _Define: proxy deadCopy _AddSlots: ( |
  1482.     _ parent* = traits xlib xTextProperty.
  1483. | )
  1484.  
  1485.  
  1486. "--- atom ---"
  1487.  
  1488. traits     xlib _AddSlotsIfAbsent: ( | ^ atom = () | )
  1489. prototypes xlib _AddSlotsIfAbsent: ( | ^ atom = () | )
  1490.  
  1491.  
  1492. traits xlib atom _Define: ( |
  1493.    _ parent** = traits proxy.
  1494.    ^ raw = ().
  1495.  
  1496.    _ whichProxy = 'xlib-atom'.
  1497. | )
  1498.  
  1499. prototypes xlib atom _Define: proxy deadCopy _AddSlots: ( |
  1500.     _ parent* = traits xlib atom.
  1501. | )        
  1502.  
  1503. prototypes xlib _AddSlots: ( |
  1504.     ^ wmProtocols    <- xlib atom deadCopy.
  1505.     ^ wmDeleteWindow <- xlib atom deadCopy.
  1506. | )
  1507.  
  1508. "must read xlib.wrappers--it adds slots into objects defined in this file"
  1509. 'xlib.wrappers' _RunScript
  1510.